package com.ly.hotel.broadcast;


import com.ly.hotel.common.Constants;
import com.ly.hotel.common.MyApplication;

import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.util.Log;

/**
 * @Description: 主要是处理ADA628主板的关机请求
 * @author HanleyTowne
 * @email  tanghly@gmail.com
 * @date   2012-7-27下午6:05:50
 * @Google+ http://gplus.to/hanleytowne 
 */
public class MyShutdownReceiver extends ShutdownReceiver {
	public static boolean flag = false;
	@Override
	public void onReceive(Context context, Intent intent) {
		if(!flag){
			super.onReceive(context, intent);
			flag = true;
			Log.e("shutdown", "系统请求关机中...");  
			
			if(Build.BOARD.endsWith(Constants.BOARD_TYPE_ADA628_NAME)){
				
				Intent intent1 = new Intent("com.ada.android.intent.action.STANDBY_SYSTEM_KEYUP");
				intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
				MyApplication.getContext().sendBroadcast(intent1);
				Log.e("shutdown", "发送广播通知系统可以关机了...");  
				
			} 
			
		}
	}
}
